<template>
	<view class="mainpadding2">
		<view class="flexcenter" v-if="!list.data.length">
			<view class="placeholderimage" style="margin-top: 300rpx;" ></view>
		</view>
		<view class="xiahuaxian margin_top" v-for="item in list.data" :key="item.id" @click="tzjlbxq(item.id)">
			<view class="flexbetween">
				<view class="shilitu">
					<image :src="item.image_text" mode=""></image>
				</view>
				<view class="" style="width: 69%;">
					<view class="flexleft">
						<view class="xiaolhbtn margin_right1" v-if="item.activity_status==1">未开始</view>
						<view class="xiaocbtn margin_right1" v-if="item.activity_status==2">报名中</view>
						<view class="xiaolabtn margin_right1" v-if="item.activity_status==3">待	开赛</view>
						<view class="xiaojubtn margin_right1" v-if="item.activity_status==4">已开赛</view>
						<view class="xiaohbtn margin_right1" v-if="item.activity_status==5">赛事结束</view>
						<view class="titletext xiaohei fonweight yhxk">{{item.name}}</view>
					</view>
					<view class="strongtext xiaohui nofonweight margin_right2 margin_top1">开始时间：{{item.bm_starttime_text}}</view>
					<view class="strongtext xiaohui nofonweight margin_right2 margin_top1">结束时间：{{item.bm_endtime_text}}</view>
					<view class="strongtext xiaohui nofonweight margin_right2 yhxk margin_top1">{{item.cityinfo}}{{item.address}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				listid:"",
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			// 跳转活动详情
			tzjlbxq(id) {
				uni.navigateTo({
					url: '/pages_julebu/huodongxq?id='+id
				})
			},
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					user_zbfapply_id:this.listid,
				}
				let url = '/api/Activitycl/activityIndex'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
.sanzi {
		width: 85rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		text-align: center;
	}
	
	.huisebtn {
		width: 140rpx;
		height: 56rpx;
		background: #F5F5F5;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #777777;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.lvsebtn {
		width: 140rpx;
		height: 56rpx;
		background: #1BA95B;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaolabtn {
		width: 80rpx;
		height: 40rpx;
		background: #078CE6;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaohbtn {
		width: 100rpx;
		height: 40rpx;
		background: #BAC3D5;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #091636;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaolhbtn {
		width: 80rpx;
		height: 40rpx;
		background: #1BA95B;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaojubtn {
		width: 80rpx;
		height: 40rpx;
		background: #F8B900;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaocbtn {
		width: 80rpx;
		height: 40rpx;
		background: #F76222;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.xiaobtn{
		width: 120rpx;
		height: 56rpx;
		background: #1BA95B;
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.shilitu {
		width: 200rpx;
		height: 160rpx;
	
		image {
			width: 100%;
			height: 100%;
		}
	}
</style>
